<template>
	<view class="flex-col page">
		<view>
			<view :style="{height:statusBarHeight+'px'}"></view>
			<u-navbar title="回寄快递" bgColor="#F5F5F5" @leftClick="$nav(2)">	
			</u-navbar>
		</view>
		
		<view class="flex-col" style="margin: 20rpx; gap: 20rpx;">
			<text>快递单号</text>
			<u--input
			    placeholder="请输入快递单号"
			    border="surround"
			    v-model="value1"
			  ></u--input>
			  <text style="margin-top: 30rpx;">快递公司</text>
			  <u--input
			      placeholder="请输入快递公司"
			      border="surround"
			      v-model="value2"
			    ></u--input>
		</view>
		
		
		<view class="sub_but" @click="submit">提交</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				aftersale_id:'',
				value1:'',
				value2:''
			};
		},
		onLoad(op) {
			this.aftersale_id = op.id;
		},
		computed:{
			statusBarHeight(){
				return this.$store.state.statusBarHeight + 44
			}
		},
		methods:{
			submit(){
				if(!this.value1){
					this.$u.toast('请输入快递单号')
					return
				}
				if(!this.value2){
					this.$u.toast('请输入快递公司')
					return
				}
				this.$request({
					url:'?c=Aftersales&a=aftersalesReturnParcel',
					type:'post',
					data:{
						aftersale_id:this.aftersale_id,
						tracking_no:this.value1,
						logistics_name:this.value2
					}
				}).then(res =>{
					uni.showToast({
						title:'提交成功'
					})
					setTimeout(()=>{
						uni.navigateBack()
					},500)
				})
			}
		}
	}
</script>

<style lang="scss">
.page{
	width: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	height: 100%;
}
.sub_but {
		text-align: center;
		background-color: $u-primary;
		color: #fff;
		line-height: 80rpx;
		border-radius: 50rpx;
		margin-top: 50rpx;
		margin-left: 35rpx;
		margin-right: 35rpx;
	}
</style>
